<template>
    <el-container>
        <el-header>
            <el-page-header @back="goBack" content="粉丝列表">

            </el-page-header>
        </el-header>
        <el-main>
          <el-card v-for="item in fansList" :key="item.username" shadow="hover">
            <img style="max-height: 100%;max-width: 100%;height:50px;width:50px;" :src="item.avatar" alt="" @click="visible=!visible"/>
            <span style="margin-left: 10px;font-size:20px">{{item.username}}</span>

<!--            <el-popover-->
<!--                placement="right"-->
<!--                width="400"-->
<!--                trigger="click"-->
<!--                v-model="visible">-->
<!--            </el-popover>-->
          </el-card>

        </el-main>
    </el-container>
</template>

<script>
    import axios from "axios";
    export default {
        name: "FansList",
        data(){
            return {
              visible:false,
              namefrom:this.$store.state.userinfo.user.user.username,
                fansList:[],
                // user:'lichishui1',
                user: this.$store.state.userinfo.user!=null?this.$store.state.userinfo.user.user.username:'',
            }
        },
        methods:{
            goBack(){
                // console.log('go back');
                this.$router.back();
            },
          SendLetter(nameto){
              this.$router.push("/send-letter?nameto="+nameto+"&namefrom="+this.namefrom);
          }
        },
        created(){
            // console.log('creating');
            // axios.get('http://localhost:8080/fansList?username='+this.user).then(
            //     Response=>{
            //         this.fansList = Response.data.data.fansList;
            //         // console.log(this.fansList);
            //     }
            // )
            var _this = this;
            _this.axios({
                method: "get",
                url: "/fansList?username="+_this.user,
            }).then(function (resp) {
                _this.fansList = resp.data.data.fansList;
            })
        }
    }
</script>

<style scoped>

</style>